<?php
// +----------------------------------------------------------------------
// |权限管理控制器
// +----------------------------------------------------------------------
namespace app\admin\controller;

use app\BaseController;
use think\facade\View;
use think\Request;
use app\admin\system\AuthGroupsService;
use app\admin\system\MenuService;
use think\response\Json;


class Authgroups extends BaseController
{
     //首页页面渲染
    public function index(){
        if(request()->isPost()){
            $param = request()->post();
            $data= AuthGroupsService::getlist($param);        
            success($data);
        }else{      
              return view::fetch();
        }
    }

    //执行添加修改
    public function create(){
        if(request()->isPost()){
            $param = request()->post();
            $data= AuthGroupsService::create($param);
            success($data);
        }else{
        }
    }
    //执行修改状态
    public function update_status(){
        $param = request()->post();
        $data= AuthGroupsService::update_status($param);
        success($data);
    }
    //执行删除
    public function delete(){
    
        $param = request()->post();
        $data= AuthGroupsService::delete($param);
        success($data);  
    }

    //权限列表展示
    public function purview(){
        if(request()->isPost()){
            $param = request()->post();
            $data= AuthGroupsService::purview($param);
            success($data);
        }else{
            $param = request()->get();          
            view::assign('id', $param['id']);   
            view::assign('title', $param['title']);  //权限名称
            return view::fetch();
        }
    }

    //添加权限列表展示
    public function create_purview(){
        $param = request()->post();
        $data= AuthGroupsService::create_purview($param);
        success($data);
    }


    
}